fix db credentials - #212
Open
MJoaaquin wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IMPORTANT
before merge this PR we should add the following vars:
And secrets:
in the github CI settings
One-time DB version realignment (if the target env has drift)
Previously, we didn't wait for the result of the service that ran the migrations, so they failed silently. We've now added code to check whether the migrations ran successfully, but this revealed on the development branch that some tables had been created outside the migration flow, causing the table that tracks them to fall behind.
Here's what I did to fix this problem in the development branch
If the deploy fails at the migration step with
column "..." already exists/relation "..." already exists, the DB schema is ahead ofalembic_version(something was applied out-of-band). Temporarily add a
stampbefore the normalmigration run, in the deploy step of the workflow, between
pullandup -d:# Pull and deploy docker compose -f compose.yml pull + # ONE-TIME: DB has schema changes applied out-of-band while alembic_version + # is behind. Realign the version pointer so the pending migrations can apply. + # REMOVE this line after the deploy that fixes it. + docker compose -f compose.yml run --rm -T chatmap-api-migrate uv run alembic stamp <REV> + # Run migrations in the foreground so alembic output/errors land in the CI log + docker compose -f compose.yml run --rm -T chatmap-api-migrate docker compose -f compose.yml up -d chatmap-ui chatmap-api chatmap-nginx chatmap-api-migrate chatmap-go --force-recreate<REV>= the revision that matches the real schema (check first withdocker compose -f compose.yml run --rm -T chatmap-api-migrate uv run alembic current).For dev it was
b7b2a3b424b8(schema hadmaps.description, version was at74a24da4d758).alembic stamp <REV>writes the revision intoalembic_versionwithout runningany migration DDL.
Remove both added lines after a successful deploy — otherwise the next deploy
stamps
alembic_versionbackwards andupgrade headfails recreating an existing table.